<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!-- jqgrid-->
<link href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css" rel="stylesheet" />
<!doctype html>
<html>
<head>
	<style type="text/css">
		*{
			margin: 0px;
			padding: 0px;
			font-size: 12px;
		}
		.laydate-icon{
			height: 20px;
		}
	</style>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		 <div class="iboxtitle">
             <span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;贷后业务>还款提醒</span>
         </div>
         <div class="ibox-content ibox-zxsearchqu ">
               <div class="row">
                   <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                  	 <div class="row">
                  	 	<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">  
	                   	   <label class="sr-only">客户名：</label>
	                       <input type="text" placeholder="客户名" id="cusName" name="cusName" class="form-control">
	                     </div>
	                     <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">    
	                       <label class="sr-only">身份证号码：</label>
	                       <input type="text" placeholder="身份证号码" id="cusIdno" name="cusIdno" class="form-control">
	                      </div> 
	                  </div>     
                   </div>
                   <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                   		<div class="row">
                   			<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">  
                   				<input id="timeLendingStart" name="timeLendingStart" placeholder="开始时间" class="laydate-icon form-control">
                   			</div>
                   			<label class="hxleft">至</label>
	                        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">  
	                        	<input id="timeLendingEnd" name="timeLendingEnd" placeholder="结束时间" class="laydate-icon form-control">
	                        </div>
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-4 col-lg-4">
                   		<button class="zhixcx" type="button" onclick="query();">执行查询</button>
                    </div>
          	</div>
          </div>
         <%--  <div class="makesure-paidan">
		   		<button type="button" class="btn dpbtn_blue btnaplly" onclick="applayAllocation('${basePath}/FkInsureListController/applayAllocation');">申请派单</button>
		   </div> --%>
          <div class="ibox-content">	
	          	<div class="jqGrid_wrapper">
		             <table id="table_list_1"></table>
		             <div id="pager_list_1"></div>
	         	</div>
          </div>
	</div>
	<!-- public quote -->
    <%@include file="/jsp/comm_js_include.jsp"%>
    <!-- layerDate plugin javascript -->
    <script src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>

	<!-- jqGrid -->
    <script type="text/javascript" charset="utf-8" src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>	
    
    <!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
    <script type="text/javascript">
	    var winWidth = $(window).width();
		var winHeight = $(window).height();
		
	    jQuery(function($) {  
	    	//日期范围限制
	        var start = {
	            elem: '#timeLendingStart',
	            format: 'YYYY-MM-DD',
	            min: '1970-01-01', //设定最小日期为当前日期
	            max: laydate.now(), //最大日期
	            istime: false,
	            istoday: false,
	            choose: function (datas) {
	                end.min = datas; //开始日选好后，重置结束日的最小日期
	                end.start = datas; //将结束日的初始值设定为开始日
	            }
	        };
	        var end = {
	            elem: '#timeLendingEnd',
	            format: 'YYYY-MM-DD',
	            min: '1970-01-01', //设定最小日期为当前日期
	            max: laydate.now(), //最大日期
	            istime: false,
	            istoday: false,
	            choose: function (datas) {
	                start.max = datas; //结束日选好后，重置开始日的最大日期
	            }
	        };
	        laydate(start);
	        laydate(end);
	        
	    	getData();
	    });
	    
	    var getData = function()
	    {
	  var winWidth = $('div.ibox-content').width();
   	   	   var winHeight = document.body.offsetHeight - 300;
  		   var win = winWidth / 9 - 20;
  	 	   $.jgrid.defaults.styleUI = 'Bootstrap';
  	 	   
		  jQuery("#table_list_1").jqGrid
		  ({
			url:'${basePath}/DhRemindLoanController/list',
	        datatype : "json",
	        postData:{remindLoanType:2},
	        colNames : [ '主键','业务ID', '最后提醒日期', '银行放款时间','客户姓名','身份证号码','贷款额','订单类型', '经销商', '经销商等级','部门', '业务员', '银行'],
	        colModel : [ 
	                     {name: 'replaceId', index: 'id', hidden:true},
	                     {name: 'busiId', index: 'busiId', hidden:true},
	                     {name: 'lastRemitDate', index: 'lastRemitDate', align: "center",width: 150, formatter:function(a,b,c){
	                       	 return formateToDate(a);
	                     }},
	                     {name: 'timeLending', index: 'timeLending', align: "center",width: 150, formatter:function(a,b,c){
	                       	 return formateToDate(a);
	                     }},
	            		 {name: 'cusName',index: 'cusName',width: 130,align: "center"},
	            		 {name: 'cusIdno',index: 'cusIdno',width: 170,align: "center"},
	            		 {name: 'loanAmount',index: 'loanAmount',width: 130,align: "center",formatter:function(a,b,c) {
	            			 return showNumber(a);
	            		 }},
	                     {name: 'channelTypeName',index: 'channelTypeName',width: 130,align: "center"},
	                  	 {name: 'dealer',index: 'dealer',width: 300,align: "center"},
	                  	 {name: 'dealerLevel',index: 'dealerLevel',width: 130,align: "center"},
	               		 {name: 'departmentName',index: 'departmentName',width: 130,align: "center"},
	                     {name: 'salersmanName',index: 'salersmanName',width: 130,align: "center"},
	            		 {name: 'bankname',index: 'bankname',width: 300,align: "center"}
	                   ],
              mtype : "post",
              height: winHeight,
              width:winWidth,  
              autowidth: false,
              shrinkToFit: false,
              rowNum: 15,
              rowList: [15, 30, 45],
              viewrecords: true,
              pager: "#pager_list_1",
              hidegrid: false,
              multiselect : false,
              sortname: 'timeLending',
              sortorder: "asc",
              altRows:true,
	           altclass:'someClass',
              ondblClickRow:function(rowId,v,e)
              {
            	  var rowData = $("#table_list_1").jqGrid("getRowData", rowId);
            	  var busiId = rowData.busiId;
            	  window.location.href="${basePath}/DhRemindLoanViewController/dhRemindRefundDetail?id=" + busiId;            	  
              },
              jsonReader : {
            	  root:"result.rows",
            	  page: "result.page",
            	  total: "result.total",
            	  records: "result.records",
            	  repeatitems: false,
            	  id: "replaceId"
              },
              loadComplete:function(datas){
            	  if (datas.flag == "100100") {
                      layer.msg("查询成功!", {icon: 6, time: 1000});
                      return;
                  }
            	  if(datas.flag == '100802') {
    				  top.location.href = thisLoginUrl;
    				  return;
    			  }

            	  layer.msg(datas.message, {icon: 2});
              }
	      });
	    }	    
	    
	    window.onresize = function() {
	    	$("#table_list_1").setGridWidth($(window).width()-80);
	    }
	    
	    var query = function() {
	    	var postData = $("#table_list_1").jqGrid("getGridParam", "postData");
	    	var data = {};
	    	data.cusName = document.getElementById('cusName').value || '';
	    	data.cusIdno = document.getElementById('cusIdno').value || '';
	    	data.timeLendingStart = document.getElementById('timeLendingStart').value || '';
	    	data.timeLendingEnd = document.getElementById('timeLendingEnd').value || '';
	    	$.extend(postData, data);
	    	refresh();
	    }
	    
	    var refresh = function() {
	    	$("#table_list_1").jqGrid("setGridParam", { search: true }).trigger("reloadGrid", [{ page: 1}]);
	    }
    </script>
</body>
</html>
